package com.yzfarm.biujoke.biujoke.mvp.model.datamanager;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;


/**
 * Created by hanhy on 2016/9/28.
 */

public class GlideImageLoader extends ImageLoader {
    @Override
    public void load(Context context, String url, ImageView iv) {
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).into(iv);
    }

    @Override
    public void load(Context context, String url, ImageView iv, int defDrawableId) {
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(defDrawableId).into(iv);
    }

    @Override
    public void load(Context context, String url, ImageView iv, Drawable defDrawable) {
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(defDrawable).into(iv);
    }

    @Override
    public void load(Context context, String url, ImageView iv, int defDrawableId, int errorDrawableId) {
        Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(defDrawableId).error(errorDrawableId).into(iv);
    }
}
